app.controller('sys_dictionaryController', ['$scope', 'httpWrapService', '$state', '$stateParams','AppConstants','TableFactory',
        function($scope, httpWrapService, $state, $stateParams,AppConstants, TableFactory) {

	$scope.params = {};
	var type = $scope.params.type = {
			field : 'type',
			type : AppConstants.filter.CONTAINS,
			term : ''
	};
	var label = $scope.params.label = {
			field : 'label',
			type : AppConstants.filter.CONTAINS,
			term : ''
	};
	var value = $scope.params.value = {
			field : 'value',
			type : AppConstants.filter.CONTAINS,
			term : ''
	};
	var description = $scope.params.description = {
			field : 'description',
			type : AppConstants.filter.CONTAINS,
			term : ''
	};
	
    $scope.Table1 = TableFactory.newInstance({
		url : 'system/dictionary/list.do',
		params : [type, label, value, description]
	});
    $scope.Table1.load();

//    $scope.add = function() {
//        $state.go('app.system.dictionary.view', {type : "add"});
//    };
//    $scope.view = function(id) {
//        $state.go('app.system.dictionary.view', {id : id, type:"update" });
//    };

    $scope.deleteDictionary = function(id) {
    	//$scope.Table1, id 这两个参数是为了在点击删除按钮后，禁用删除按钮
        httpWrapService.defaultFootTableDelete($scope.Table1, id, 'system/dictionary/delete/'+ id +'.do',{},'是否确定要删除数据字典？').then(function(res){
        	$scope.Table1.load();
        });
    };

}]);